package com.vertx.cluster;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;

/**
 * 1. 同一网段 (192.168.1.x)
 * 2. 不严格的轮询策略
 */
public class Receiver extends AbstractVerticle {

	@Override
	public void start() throws Exception {

		EventBus eb = vertx.eventBus();

		eb.consumer("my-address", message -> {

			System.out.println("Received message: " + message.body());
			// Now send back reply
			message.reply("Ok!");
		});

		System.out.println("Receiver ready!");
	}
}
